package eip.chapter7.contentrouter;

public enum RoomType {
	
	SingleRoom, DoubleRoom, Suite;
	
	public static final String XML_SINGLE_ROOM = "Single room";
	public static final String XML_DOUBLE_ROOM = "Double room";
	public static final String XML_SUITE = "Suite";
	
	public static RoomType deserialize(String roomType) {
		if(XML_SINGLE_ROOM.equals(roomType)) {
			return RoomType.SingleRoom;
		} else if(XML_DOUBLE_ROOM.equals(roomType)) {
			return RoomType.DoubleRoom;
		} else if(XML_SUITE.equals(roomType)) {
			return RoomType.Suite;
		} else {
			return null;
		}
	}
	
	public static String serialize(RoomType roomType) {
		if(roomType.equals(RoomType.SingleRoom)) {
			return XML_SINGLE_ROOM;
		} else if(roomType.equals(RoomType.DoubleRoom)) {
			return XML_DOUBLE_ROOM;
		} else if(roomType.equals(RoomType.Suite)) {
			return XML_SUITE;
		} else {
			return null;
		}
	}
}
